import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite'
// import requireTransform from 'vite-plugin-require-transform';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

export default defineConfig({
  plugins: [
  	
  	//配置插件
    // requireTransform({
    //   fileRegex: /.js$|.vue$/
    // }),
  	AutoImport({
      resolvers: [ElementPlusResolver()],
  		imports:['vue','vue-router']
  	}),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
    
    vue(),
  ],
  resolve: {
    
    // 配置路径别名
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
  server:{
    proxy:{
      '/api':'http://testapi.xuexiluxian.cn'
    }
  },
    rollupOptions: {
      external: [
          "element-plus"
      ]
    }
  
});